Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
How does the statement "public typealias AnyObject" make AnyObject a protocol?

When I pressed Command and clicked AnyObject to navigate to the interface of the AnyObject, I came across the below definition:

public typealias AnyObject

I see this comment written above the definition:

The protocol to which all classes implicitly conform.

Well I don't understand how this definition makes AnyObject a protocol without explicitly using the keyword protocol. Also, it's a typealias without = someType, which is an invalid statement.

I can't write a statement like:

public typealias SomeOtherObject

It gives a compilation error.

Can anyone explain what exactly is happening here?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The thing is that by pressing on AnyObject holding CMD you will not actually see source code, but just a public interface. If you will go deep into Swift source code you will actually find out that

public typealias AnyObject

is actually looks like this:

public typealias AnyObject = Builtin.AnyObject

Here is the link to file containing this code https://github.com/apple/swift/blob/master/stdlib/public/core/Policy.swift

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda